package shared

import shared.Pojo._

/**
 * Created by yz on 30/10/2020
 */
object SharedTool {

  def getIndexMap(kinds: List[String]) = {
    kinds.zipWithIndex.groupMap(_._1)(_._2).values.flatMap { indexs =>
      indexs.zipWithIndex
    }.toMap
  }

  def getKind(idStr: String) = {
    idStr.replaceAll("_\\d+$", "")
  }

  def getId(idStr: String) = {
    idStr.replaceAll("^.*_", "").toInt
  }

}
